import http from "@/plugins/aixos";
import store from "@/utils/store";

export function findAllProj() {
  const token = store.get("token");
  return http.request<ProjDataInter[]>({
    url: "/proj",
    method: "GET",
    headers: { Authorization: "Bearer " + token },
  });
}

export function addProj(data: ProjDataInter) {
  const token = store.get("token");
  return http.request<ProjDataInter>({
    url: "/proj",
    method: "POST",
    data,
    headers: { Authorization: "Bearer " + token },
  });
}

export function delProj(id: number) {
  return http.request<ProjDataInter>({
    url: "/proj/" + id,
    method: "DELETE",
  });
}

export function updateProj(id: number, data: ProjDataInter) {
  return http.request<ProjDataInter>({
    url: "/proj/" + id,
    method: "PATCH",
    data,
  });
}

export function findProj(id: number) {
  return http.request<ProjDataInter>({
    url: "/proj/" + id,
    method: "GET",
  });
}
